1. Field of the Invention
The present invention generally relates to an image processing apparatus in which error diffusion is performed on multi-tone image data, and the multi-tone image data is quantized so that the number of bits of the data is reduced.
2. Description of the Related Art
Generally speaking, in such an image processing apparatus, when input image data is controlled, the control is performed based on a sub-scan range signal and a main scan range signal which indicate an image range in a sub-scan direction and an image range in a main scan direction, respectively, and a main scan synchronization signal which indicates a starting point. Description will now be made with reference to a digital copier shown in FIGS. 1 and 2. An original-image sheet is set on an original-image-sheet table 1 in a condition in which a side to be read faces downward. The original-image sheet is illuminated by a light source 2, and, thereby, light is reflected by the original-image sheet. The reflected light is read by a CCD image sensor (hereinafter, simply referred to as a CCD) 5 via a mirror 3, and a lens-and-relay-mirror group 4.
Then, with reference to FIG. 3, a relation between read image data and image control signals will now be described. The sub-scan range signal FGATE indicates a range in which the light source 2 and mirror 3 scan the original-image sheet in the sub-scan direction. The main scan range signal LGATE indicates a range in which the CCD 5 scans the original-image sheet in the main scan direction. Reading in the main scan direction performed by the CCD 5 is performed line by line, that is, line 1, line 2, line 3, . . . , based on the main scan synchronization signal LSYNC, as shown in FIG. 4. FIG. 5 shows timings of these signals xfgate (FGATE), xlgate (LGATE) and xlsync (LSYNC).
In the digital copier, in order to process the read image data, a CPU 10 sends instructions of processing and setting to a scanner 11, an image processing portion 12, an image storing portion 13 and a printer 14, as shown in FIG. 6. The image data read through the CCD 5 is converted from an analog signal into a digital signal through the scanner 11 and correction depending on characteristics of the scanner is performed on the image data. Then, the image processing portion 12 performs image-quality processing such as dither, error diffusion and or the like on the image data. Then, the image data is output to the image storing portion 13 in accordance with an image format of a subordinate block. The image storing portion 13 has at least an image editing memory for one sheet of copy output paper (transfer paper) and a large-capacity storage medium such as a HD (Hard Disk). The printer 14 prints the image on the transfer paper based on the image data from the image storing portion 13.
FIG. 7 shows an error-diffusion processing portion in the image processing portion 12 in the related art. An error adding portion 100 performs error correction by adding together input image data Dij of a to-be-processed pixel (i, j) and peripheral error information E from an error operation portion 104. Image data Sij obtained as a result of the error correction being performed on the image data Dij is quantized based on quantization thresholds Tij (N bits, for input image data=M (bits), where M greater than N) and thus undergoes tone processing. Thus-obtained quantized data Gij is output to a phase control portion 105 and an error calculating portion 102. The phase control portion 105 performs phase control on the quantized data Gij in accordance with a phase control setting provided by the CPU 11, and outputs thus-obtained data to a following stage.
Based on the image data Sij obtained through the error correction and the quantized data Gij, the error calculating portion 102 calculates a quantization error Eij at the time the input image data Dij has been quantized. The quantization error Eij is stored in an error-matrix storing portion 103. Based on this quantization error Eij and the coefficients of a matrix of 5+2 pixels (error diffusion matrix) such as that shown in FIG. 8, the error operation portion 104 calculates input-image-data-Dij peripheral error information E as shown in the following equation (1), and provides the calculated information E to the error adding portion 100:
E=(Eixe2x88x922, jxe2x88x921+2xc3x97Eixe2x88x921, jxe2x88x921+4xc3x97Ei, jxe2x88x921+2xc3x97Ei+1, jxe2x88x921+Ei+2, jxe2x88x921+2xc3x97Eixe2x88x922, j+4xc3x97Eixe2x88x921, j)/16xe2x80x83xe2x80x83(1)
However, when the error-diffusion processing is performed, image degradation due to texture unique to this processing occurs. In order to prevent it, in the related art, for example, as disclosed in Japanese Laid-Open Patent Application No. 9-233348, when a multi-tone image is quantized into a two-tone image using a converting-into-two-tone-image-data threshold in an Nxc3x97M matrix, blue noise is reduced as a result of adding a random number to the converting-into-two-tone-image-data threshold.
In the above-mentioned related art, because a random number is added to the converting-into-two-tone-image-data threshold, this method can be used in a case where a multi-tone image is quantized into a two-tone image. However, it is not possible to use this method in a case where a multi-tone image is converted into a three-or-more-tone image. If this method is applied to the above-mentioned case, in a three-or-more-tone image, a pseudo-contour frequently appears due to change in texture due to repetition of quantized data obtained as a result of data close to a quantization threshold being quantized and quantized data obtained as a result of data at the middle between adjacent quantization thresholds being quantized.
Further, with a recent improvement in processing ability, an image data format in image processing and a relationship between a synchronization signal of image data and image data are improved, the number of quantization bits is reduced and the image data for a plurality of pixels is packed, and, thereby, the image data for the plurality of pixels are processed at once, and a plurality of lines are processed in parallel as disclosed by Japanese Laid-Open Patent Application No. 10-13626, or each line is divided and image data of respective divisions are processed in parallel, so that the image processing speed has been improved.
The present invention has been devised in consideration of the above-mentioned problem, and an object of the present invention is to provide an image processing apparatus which can prevent texture in a case where error diffusion is performed on multi-tone image data and thus the multi-tone image data is quantized into data so that the number of bits of the multi-tone image data is reduced.
Another object of the present invention is to provide an image processing apparatus which can prevent texture and perform high-speed processing in a case where error diffusion is performed on multi-tone image data obtained as a result of each line being divided and thus-obtained divisions being read separately and in parallel, that is, an original image being read in a manner in which corresponding divisions of the original image are read separately in parallel, and the multi-tone image data is quantized into data so that the number of bits of the multi-tone image data is reduced.
In order to achieve the above-mentioned objects, an image processing apparatus according to the present invention comprises:
an error adding portion which adds together input multi-tone image data and peripheral error information;
an adding/subtracting portion which adds to or subtracts from multi-tone image data calculated by the error adding portion, a random number in a matrix prepared for each set of pixels of the input multi-tone image data;
a quantizing portion which quantizes multi-tone image data calculated by the adding/subtracting portion into image data, the number of bits of which image data being smaller than the number of bits of the multi-tone image data calculated by the adding/subtracting portion;
an error calculating portion which calculates an error based on the multi-tone image data calculated by the adding/subtracting portion and the image data quantized by the quantizing portion;
an error storing portion which stores the error calculated by the error calculating portion for each peripheral pixel; and
an error operation portion which calculates peripheral error information based on the errors stored by the error storing portion for respective peripheral pixels, and provides the peripheral error information to the error adding portion.
In this arrangement, a random number in a matrix prepared for each set of pixels of input multi-tone image data is added to or subtracted from multi-tone image data, and thus-calculated multi-tone image data is quantized so that the number of bits of thus-obtained image data is smaller than the number of bits of the above-mentioned calculated multi-tone image data. Therefore, in a case where error diffusion is performed on multi-tone image data and thus the multi-tone image data is quantized so that the number of bits of the image data is reduced, texture can be prevented from occurring.
An image processing apparatus according to another aspect of the present invention comprises:
an error adding portion which adds together input multi-tone image data and peripheral error information;
an adding/subtracting portion which adds to or subtracts from, in accordance with 1-bit data in a matrix prepared for each set of pixels of the input multi-tone image data, multi-tone image data calculated by the error adding portion, a predetermined adding/subtracting value;
a quantizing portion which quantizes multi-tone image data calculated by the adding/subtracting portion into image data, the number of bits of which image data being smaller than the number of bits of the multi-tone image data calculated by the adding/subtracting portion;
an error calculating portion which calculates an error based on the multi-tone image data calculated by the adding/subtracting portion and the image data quantized by the quantizing portion;
an error storing portion which stores the error calculated by the error calculating portion for each peripheral pixel; and
an error operation portion which calculates peripheral error information based on the errors stored by the error storing portion for respective peripheral pixels, and provides the peripheral error information to the error adding portion.
In this arrangement, because data in the matrix prepared for each set of pixels of the input multi-tone image data is 1-bit data indicating either addition or subtraction, it is possible to prevent texture from occurring without increasing the capacity of the memory.
An image processing apparatus according to another aspect of the present invention comprises a plurality of error-diffusion processing portions provided for image data of a plurality of divisions of each line, respectively, each of the plurality of error-diffusion processing portions comprising:
an error adding portion which adds together input multi-tone image data of a respective one of the plurality of divisions and peripheral error information;
an adding/subtracting portion which adds to or subtracts from multi-tone image data calculated by the error adding portion, a random number in a matrix prepared for each set of pixels of the input multi-tone image data of the respective one of the plurality of divisions;
a quantizing portion which quantizes multi-tone image data calculated by the adding/subtracting portion into image data, the number of bits of which image data being smaller than the number of bits of the multi-tone image data calculated by the adding/subtracting portion;
an error calculating portion which calculates an error based on the multi-tone image data calculated by the error adding portion and the image data quantized by the quantizing portion;
an error storing portion which stores the error calculated by the error calculating portion for each peripheral pixel; and
an error operation portion which calculates the peripheral error information based on the errors stored in the error storing portion for respective peripheral pixels, and provides the peripheral error information to the error adding portion,
wherein, in order to enable the error operation portion of each of the plurality of error-diffusion processing portions to calculate the peripheral error information based on the errors of respective peripheral pixels at a boundary between adjacent divisions, the error of at least one peripheral pixel at the boundary is sent/received between at least two error storing portions.
In this arrangement, in a case where each line is divided into a plurality of divisions, and error-diffusion processing is performed on image data of each one of the plurality of divisions, in order to enable each of a plurality of error operation portions to calculate peripheral error information based on errors of respective peripheral pixels at a boundary, error(s) of peripheral pixel(s) at the boundary is(are) sent/received between error storing portions. Thereby, it is possible to prevent texture from occurring and to achieve high-speed processing, in a case where each line is divided into a plurality of divisions, error-diffusion processing is performed on multi-tone image data of each one of the plurality of divisions, and, thus, the multi-tone image data is quantized so that the number of bits of the image data is reduced.